package com.changeover.gwt.client.view.impl;

import com.changeover.gwt.client.view.IMainView;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TabLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public class MainView extends Composite implements IMainView {

    private final TabLayoutPanel tabPanel;
    private final TaskView taskView;

    public MainView() {
        DecoratorPanel contentDecorator = new DecoratorPanel();

        initWidget(contentDecorator);
        contentDecorator.setSize("100%", "100%");
        
        tabPanel = new TabLayoutPanel(2.5, Unit.EM);
        tabPanel.setAnimationDuration(400);
        tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);

        taskView = new TaskView();
        tabPanel.add(taskView, "Tasks");
        HTML tabTranche = new HTML("Tranche");
        tabPanel.add(tabTranche, "Tranche");
        tabTranche.setSize("100%", "100%");
        HTML tabTotal = new HTML("Total");
        tabPanel.add(tabTotal, "Total");
        tabTotal.setSize("100%", "100%");
        HTML tabPersonal = new HTML("Personal");
        tabPanel.add(tabPersonal, "Personal");
        tabPersonal.setSize("100%", "100%");

        // Return the content
        tabPanel.selectTab(0);
        tabPanel.ensureDebugId("cwTabPanel");
        
        contentDecorator.setWidget(tabPanel);
        tabPanel.setSize("900px", "700px");

    }
    
    public TaskView getTaskView() {
        return taskView;
    }


    public Widget asWidget() {
        return this;
    }

}
